// utils/navigate.js
export default {
  install(Vue) {
    Vue.prototype.$navigateTo = function(url, params = {}, type = 'navigateTo') {
      const query = Object.keys(params)
        .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
        .join('&');
      const fullUrl = query ? `${url}?${query}` : url;

      uni[type]({
        url: fullUrl
      });
    };
  }
};